- /* scfcsin.cpp by K.Tsuru */
- // function ID = 9113
- /*****************************************
- SComplex class
- It returns sin(z).
- Let z = x+iy,
- sin(z) = sin(x)*cosh(y)+i*cos(x)sinh(y)
- = (i/2)*[exp(-iz)- exp(iz)]
- *****************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
-
- #define UseMultI 0
-
- SComplex Csin(const SComplex& z){
- #if 0 // 16.1 sec
- SDouble rr, ri, sh;
- sh = Sinh(z.Imag());
- rr = Sin(z.Real())*Sqrt(1.0+sh*sh);
- ri = Cos(z.Real())*sh;
-
- return SComplex(rr, ri);
-
- #elif UseMultI // 15.9 sec
- SComplex eiz = Cexp(MultI(z)), r;
- r = 1.0/eiz - eiz;
- r.MultI();
- return r.CsDiv(2L); // faster than r/2
- #else // 15.8 sec
- SComplex eiz = Cexp(IU*z), r;
- r = 1.0/eiz - eiz;
- r *= IU; // faster than r = r*I
- return r.CsDiv(2L); // faster than r/2
- #endif
- }
scfcsin.cpp : last modifiled at 2015/10/23 15:49:01(819 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:09 (Fri Oct 06 15:27:09 2017).